-- @owner: @zhangbingliang
-- @date: 2025-07-31
-- @testpoint: 定义多个cursor，进行fecth操作后查询@@FETCH_STATUS
-- @modify: modified by @zhangbingliang at 2025-07-31

--prestep1:连接到D库
@conn PrimaryDbDmode;

--step1:建表;expect:成功
drop table if exists t_fetch0005_01;
create table t_fetch0005_01(c1 int);
insert into t_fetch0005_01 values(1);

--调用2个cursor，进行fetch操作后查询@@FETCH_STATUS;expect:成功
begin; /
cursor cur_fetch0005_01 for select * from t_fetch0005_01;
cursor cur_fetch0005_02 for select * from t_fetch0005_01;
fetch next from cur_fetch0005_01;
select @@FETCH_STATUS;
fetch next from cur_fetch0005_02;
select @@FETCH_STATUS;
fetch last from cur_fetch0005_01;
select @@FETCH_STATUS;
fetch next from cur_fetch0005_02;
select @@FETCH_STATUS;
close cur_fetch0005_01;
close cur_fetch0005_02;
end;

--清理环境
drop table t_fetch0005_01;